package com.example.video.common.config.RabbitMQ;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 * 创建视频合并转码消息队列配置
 * <p/>
 *
 * @author : yj
 */
@Configuration
public class VideoTranscode {

    // 视频转码队列
    public static final String REQUEST_QUEUE = "TRANSCODE_REQUEST_QUEUE";

    // 视频转码队列
    public static final String RESPONSE_QUEUE = "TRANSCODE_REQUEST_QUEUE";

    // 转码请求队列标识
    public static final String REQUEST_KEY = "TRANSCODE_REQUEST_KEY";

    // 转码响应队列标识
    public static final String RESPONSE_KEY = "RANSCODE_RESPONSE_KEY";


    @Bean
    public Queue requestQueue() {
        return QueueBuilder.durable(REQUEST_QUEUE).build();
    }

    @Bean
    public Queue responseQueue() {
        return QueueBuilder.durable(RESPONSE_QUEUE).build();
    }

    @Bean
    public Binding transcodeRequest() {
        return new Binding(REQUEST_QUEUE, Binding.DestinationType.QUEUE, Common.EXCHANGE, REQUEST_KEY, null);
    }

    @Bean
    public Binding transcodeResponse() {
        return new Binding(RESPONSE_QUEUE, Binding.DestinationType.QUEUE, Common.EXCHANGE, RESPONSE_KEY, null);
    }

}